package com.league.zjxn.jetpack.repository

import com.league.zjxn.app.SPSConstance
import com.league.zjxn.base.BaseManager
import com.league.zjxn.entity.*
import rxhttp.RxHttp
import rxhttp.await

open class SameRepository : BaseManager() {

    suspend fun sameAllianceDetails(id: String): SameDetailsResponse =
        RxHttp.get("/api/alliance/getDetails")
            .addHeader("token", SPSConstance.token ?: "")
            .add("id", id)
            .await()

    suspend fun sameAboutDetails(id: String): SameDetailsResponse =
        RxHttp.get("/api/about/getDetails")
            .addHeader("token", SPSConstance.token ?: "")
            .add("id", id)
            .await()

    suspend fun sameProjectDetails(id: String): ProjectDetailsResponse =
        RxHttp.get("/api/project/getDetails")
            .addHeader("token", SPSConstance.token ?: "")
            .add("id", id)
            .await()

    suspend fun sameLeagueDetails(id: String): LeagueDetailsResponse =
        RxHttp.get("/api/enterprise/getDetails")
            .addHeader("token", SPSConstance.token ?: "")
            .add("id", id)
            .await()

    suspend fun sameTrendDetails(id: String): TrendDetailsResponse =
        RxHttp.get("/api/news/getDetails")
            .addHeader("token", SPSConstance.token ?: "")
            .add("id", id)
            .await()

    suspend fun sameAgreePrivacyDetails(): AgreeResponse =
        RxHttp.get("/api/getPrivacyPolicy")
            .addHeader("token", SPSConstance.token ?: "")
            .await()

    suspend fun sameAgreeUserDetails(): AgreeResponse =
        RxHttp.get("/api/getUserAgreement")
            .addHeader("token", SPSConstance.token ?: "")
            .await()


    suspend fun sameAgreeProtocolDetails(): AgreeResponse =
        RxHttp.get("/api/protocol/getProtocol")
            .addHeader("token", SPSConstance.token ?: "")
            .add("type", "1")
            .await()
}